<?php
/**
 * 功能描述：	系统用户登录
 * @datetime	2022-07-08
 * @version   	v2.3.0
 * @author   	ZHL
 * @copyrigh  	2022 ZHL 版权所有
 */

class Admin_LoginController extends Controller {

    /**
     * Notes:登录_页面
     * User: ZhuHaili
     * Date: 2022/7/8
     */
    function index(){
		$title = isset($GLOBALS['ADMIN']['sys_name']) ? $GLOBALS['ADMIN']['sys_name'] : '管理后台';
		$verifyFlag = isset($GLOBALS['ADMIN']['verify_flag']) ? $GLOBALS['ADMIN']['verify_flag'] : 0;
        $loginPic = $GLOBALS['ADMIN']['login_pic'];
        $this->set('title', $title);
        $this->set('verifyFlag', $verifyFlag);
		$this->set('loginPic', SYS_LINK.$loginPic);
		$this->set('devKey', Fun::input('dev', 0));
		$this->display();
    }

    /**
     * Notes:登录_操作
     * User: ZhuHaili
     * Date: 2022/7/8
     */
	function login(){
		$manageUser = Fun::input('manage_user');
		$managePwd = Fun::input('manage_pwd');
        $manageCode = Fun::input('manage_code');
        $manageKey = Fun::input('manage_key');
		$LoginSer = new Admin_LoginServe();
		$result = $LoginSer->goUserLogin($manageUser, $managePwd, $manageCode, $manageKey);
		if($result == 'Y'){
            SYS_REDIRECT('admin_index');
		}else{
            SYS_JUMP($result,'admin_login');
		}
	}

    /**
     * Notes:退出登录
     * User: ZhuHaili
     * Date: 2022/7/8
     */
	function out(){
        SYS_SESSIONS_DEL(LOGIN_SESSION_FIX.'alogin_info');
        SYS_REDIRECT('admin_login');
	}
}